package com.qf.pojo;
//购物车项实体

public class CartItem {
    //商品实体
    private Product product;
    //商品数量
    private Integer count;
    //商品小计
    private Double subTotal = 0.0 ;

    public CartItem() {
    }
      //商品小计可以计算出来
    public CartItem(Product product, Integer count) {
        this.product = product;
        this.count = count;
    }

    public Product getProduct() {
        return product;
    }

    public void setProduct(Product product) {
        this.product = product;
    }

    public Integer getCount() {
        return count;
    }

    public void setCount(Integer count) {
        this.count = count;
    }

    public Double getSubTotal() {
        return subTotal = product.getShop_price()*this.count;
    }

    public void setSubTotal(Double subTotal) {
        this.subTotal = subTotal;
    }

    @Override
    public String toString() {
        return "CartItem{" +
                "product=" + product +
                ", count=" + count +
                '}';
    }
}
